Class CodeIgniter

Summary

Fully Qualified Name: CodeIgniter\CodeIgniter

Description

This class is the core of the framework, and will analyse the request, route it to a controller, and send back the response.

Of course, there are variations to that flow, but this is the brains.

Methods

Name Description Defined By
__construct() Constructor. CodeIgniter
cache() Tells the app that the final output should be cached. CodeIgniter
cachePage() Caches the full response from the current request. Used for full-page caching for very high performance. CodeIgniter
displayCache() Determines if a response has been cached for the given URI. CodeIgniter
displayPerformanceMetrics() Replaces the memory_usage and elapsed_time tags. CodeIgniter
getPerformanceStats() Returns an array with our basic performance stats collected. CodeIgniter
initialize() Handles some basic app and environment setup. CodeIgniter
run() Launch the application! CodeIgniter
setPath() Allows the request path to be set from outside the class, instead of relying on CLIRequest or IncomingRequest for the path. CodeIgniter
setRequest() Sets a Request object to be used for this request. CodeIgniter
spoofRequestMethod() Modifies the Request Object to use a different method if a POST variable called _method is found. CodeIgniter
storePreviousURL() If we have a session object to use, store the current URI as the previous URI. This is called just prior to sending the response to the client, and will make it available next request. CodeIgniter
useSafeOutput() Set our Response instance to "pretend" mode so that things like cookies and headers are not actually sent, allowing PHP 7.2+ to not complain when ini_set() function is used. CodeIgniter

Method Details

__construct()

Constructor.

Parameter Name Type Description
$config \type

Returns:

cache()

Tells the app that the final output should be cached.

Parameter Name Type Description
$time int

Returns: void

cachePage()

Caches the full response from the current request. Used for full-page caching for very high performance.

Parameter Name Type Description
$config \Config\Cache

Returns: mixed

displayCache()

Determines if a response has been cached for the given URI.

Parameter Name Type Description
$config \Config\Cache

Returns: bool|\CodeIgniter\HTTP\ResponseInterface

displayPerformanceMetrics()

Replaces the memory_usage and elapsed_time tags.

Parameter Name Type Description
$output string

Returns: string

getPerformanceStats()

Returns an array with our basic performance stats collected.

Returns: array

initialize()

Handles some basic app and environment setup.

Returns:

run()

Launch the application!

This is "the loop" if you will. The main entry point into the script that gets the required class instances, fires off the filters, tries to route the response, loads the controller and generally makes all of the pieces work together.

Parameter Name Type Description
$routes \CodeIgniter\Router\RouteCollectionInterface
$returnResponse bool

Returns: bool|\CodeIgniter\HTTP\RequestInterface|\CodeIgniter\HTTP\Response|\CodeIgniter\HTTP\ResponseInterface|mixed

setPath()

Allows the request path to be set from outside the class, instead of relying on CLIRequest or IncomingRequest for the path.

This is primarily used by the Console.

Parameter Name Type Description
$path string

Returns: $this

setRequest()

Sets a Request object to be used for this request.

Used when running certain tests.

Parameter Name Type Description
$request \CodeIgniter\HTTP\Request

Returns: \CodeIgniter\CodeIgniter

spoofRequestMethod()

Modifies the Request Object to use a different method if a POST variable called _method is found.

Returns:

storePreviousURL()

If we have a session object to use, store the current URI as the previous URI. This is called just prior to sending the response to the client, and will make it available next request.

This helps provider safer, more reliable previous_url() detection.

Parameter Name Type Description
$uri \CodeIgniter\HTTP\URI

Returns:

useSafeOutput()

Set our Response instance to "pretend" mode so that things like cookies and headers are not actually sent, allowing PHP 7.2+ to not complain when ini_set() function is used.

Parameter Name Type Description
$safe bool

Returns: $this

Top